from langchain_community.llms import Ollama
from langchain.chains import LLMChain
from langchain.prompts import ChatPromptTemplate
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

# 初始化Ollama模型
llm = Ollama(model="deepseek-r1:1.5b",
             base_url="http://192.168.2.208:11434")

# 创建提示模板
prompt = ChatPromptTemplate.from_template(
    "用简单的语言解释以下概念: {concept}"
)

# 创建链
chain = LLMChain(llm=llm, prompt=prompt)

# 运行链
concept = "llamaIndex"
result = chain.run(concept=concept)
print(result)